package com.yxh.bigdata.mapreduce.test.flowsum;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class FlowPartitioner extends Partitioner<Text, FlowWritable> {

    @Override
    public int getPartition(Text o, FlowWritable o2, int i) {
        int f = 0;
        //根据号段返回相应分区
        switch (o.toString().substring(0,2)){
            case "13": f = 1;break;
            case "15": f = 2;break;
            case "18": f = 3;break;
            default: ;
        }
        return f;
    }
}
